package crawer.util;
import java.io.*;

public class ReadFile {
	 static String file2str(String filename){
		File file = new File(filename);
		if(!file.exists() ||file.isDirectory()){
			return "";
		}
		StringBuffer sb = new StringBuffer();
		try{
		BufferedReader br = new BufferedReader( new FileReader(file));
		char[] buffer = new char[1024];
		int len = -1;
		while((len=br.read(buffer))>0){
			sb.append(buffer, 0, len);
		}
		}catch(Exception e){
			e.printStackTrace();
		}
		return sb.toString();
	}
}
